package com.star.eastern.blee.utils

import android.bluetooth.BluetoothDevice
import com.tangula.android.utils.ApplicationUtils
import com.tangula.android.utils.SharedPreferencesUtils

class DeviceLocalInfoUtils {
    companion object {


        private const val KEY_BT_NAMES = "bt_names"

        fun loadDeviceLocalName(device: BluetoothDevice): String {
            return SharedPreferencesUtils.getStringPrivate(
                ApplicationUtils.APP,
                KEY_BT_NAMES,
                device.address,
                device.name
            ) ?: device.name
        }

        fun saveDeviceLocalName(device: BluetoothDevice, localName: String): String {
            SharedPreferencesUtils.putStringPrivateA(
                ApplicationUtils.APP,
                KEY_BT_NAMES, device.address, localName)
            return localName
        }
    }
}